﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAO;
using DTO;

namespace BUS
{
    public class LoaiTBBUS
    {
/*-------------------------LOAD----------------------------------------------------
LOADLOAITB
LOADLOAITB_MALOAI @MaLoai int
LOADLOAITB_TENLOAI @TenLoai nvarchar(20)*/

        public DataTable LoadLoaiTBDien()
        {
            LoaiTBDAO ltbDAO = new LoaiTBDAO();
            return ltbDAO.LoadLoaiTBDien();
        }

        public void ThemLoaiTBDien(LoaiTBDTO ltbDTO)
        {
            LoaiTBDAO ltbDAO = new LoaiTBDAO();
            ltbDAO.ThemLoaiTBDien(ltbDTO);
        }

        public int SuaLoaiTBDien(LoaiTBDTO ltbDTO)
        {
            LoaiTBDAO ltbDAO = new LoaiTBDAO();
            return ltbDAO.SuaLoaiTBDien(ltbDTO);
        }

        public int XoaLoaiTBDien(LoaiTBDTO ltbDTO)
        {
            LoaiTBDAO ltbDAO = new LoaiTBDAO();
            return ltbDAO.XoaLoaiTBDien(ltbDTO);
        }

        public int KTLoaiTBDien(LoaiTBDTO ltbDTO)
        {
            LoaiTBDAO ltbDAO = new LoaiTBDAO();
            return ltbDAO.KTLoaiTBDien(ltbDTO);
        }

        public int KTMaLoaiTBDien(LoaiTBDTO ltbDTO)
        {
            LoaiTBDAO ltbDAO = new LoaiTBDAO();
            return ltbDAO.KTMaLoaiTBDien(ltbDTO);
        }

/*-------------------------INSERT----------------------------------------------------
THEMLOAITB @TenLoai nvarchar(20)
 */
        //Trả về 1 nếu thành công, 0 ngược lại
        public int ThemLoaiTB(LoaiTBDTO ltb)
        {
            LoaiTBDAO _ltb = new LoaiTBDAO();
            return _ltb.ThemLoaiTB(ltb);
        }
/*-------------------------UPDATE----------------------------------------------------
SUALOAITB @MaLoai int,@TenLoai nvarchar(20)
 */
        public int SuaLoaiTB(LoaiTBDTO ltb)
        {
            LoaiTBDAO _ltb = new LoaiTBDAO();
            return _ltb.SuaLoaiTB(ltb);
        }
/*-------------------------DELETE----------------------------------------------------
XOALOAITB @MaLoai int
*/
        public int XoaLoaiTB(string MaLoai)
        {
            LoaiTBDAO _ltb = new LoaiTBDAO();
            return _ltb.XoaLoaiTB(MaLoai);
        }
    }
}
